package hcom.model.member.dao;

import hcom.model.member.bean.MemberBean;

import java.util.List;

import com.ibatis.dao.client.DaoManager;

import ecg.dao.DaoService;

public class MemberDao {
	private static MemberDao singleton;
	
	protected MemberDao() {}
	
	public static MemberDao getInstance() {
		if(singleton == null) {
			singleton = new MemberDao();
		}
		
		return singleton;
	}
	
	private DaoManager	manager	= DaoService.getInstance();
	private IMember		member	= (IMember)manager.getDao(IMember.class, "hcom");
	
	/**
	 * 관리자 회원 목록
	 * @param memberBean
	 * @return
	 * @throws Exception
	 */
	public List<MemberBean> getAdminList() throws Exception {
		return member.getAdminList();
	}
	
	/**
	 * 관리자 회원 목록 갯수
	 * @return
	 * @throws Exception
	 */
	public int getAdminCount() throws Exception {
		return member.getAdminCount();
	}
	
	/**
	 * 관리자 회원 상세보기
	 * @param mem_seq
	 * @return
	 * @throws Exception
	 */
	public MemberBean getAdminDetail(int mem_seq) throws Exception {
		MemberBean memberBean = new MemberBean();
		memberBean.setMem_seq(mem_seq);
		
		return member.getAdminDetail(memberBean);
	}
	
	/**
	 * 관리자 회원 등록
	 * @param memberBean
	 * @throws Exception
	 */
	public void insertAdmin(MemberBean memberBean) throws Exception {
		member.insertAdmin(memberBean);
	}
	
	/**
	 * 관리자 회원 수정
	 * @param memberBean
	 * @throws Exception
	 */
	public void updateAdmin(MemberBean memberBean) throws Exception {
		member.updateAdmin(memberBean);
	}
	
	/**
	 * 관리자 회원 삭제
	 * @param mem_seq
	 * @throws Exception
	 */
	public void deleteAdmin(int mem_seq) throws Exception {
		member.deleteAdmin(mem_seq);
	}
	
	/**
	 * 팀장 회원 목록
	 * @param memberBean
	 * @return
	 * @throws Exception
	 */
	public List<MemberBean> getLeaderList() throws Exception {
		return member.getLeaderList();
	}
	
	/**
	 * 팀장 회원 목록 갯수
	 * @return
	 * @throws Exception
	 */
	public int getLeaderCount() throws Exception {
		return member.getLeaderCount();
	}
	
	/**
	 * 팀장 회원 상세보기
	 * @param mem_seq
	 * @return
	 * @throws Exception
	 */
	public MemberBean getLeaderDetail(int leader_seq) throws Exception {
		MemberBean memberBean = new MemberBean();
		memberBean.setLeader_seq(leader_seq);
		
		return member.getLeaderDetail(memberBean);
	}
	
	/**
	 * 팀장 회원 등록
	 * @param memberBean
	 * @throws Exception
	 */
	public void insertLeader(MemberBean memberBean) throws Exception {
		member.insertLeader(memberBean);
	}
	
	/**
	 * 팀장 회원 수정
	 * @param memberBean
	 * @throws Exception
	 */
	public void updateLeader(MemberBean memberBean) throws Exception {
		member.updateLeader(memberBean);
	}
	
	/**
	 * 팀장 회원 삭제
	 * @param mem_seq
	 * @throws Exception
	 */
	public void deleteLeader(int leader_seq) throws Exception {
		member.deleteLeader(leader_seq);
	}
}
